const fs = require("fs");
const url = require("url");
function static(baseUrl){
    return function(req, res){
        const u = url.parse(req.url);
        let data;
        try {
            data = fs.readFileSync(baseUrl + u.pathname);
            res.write(data);
            res.end();
        } catch (error) {
            console.log("1", error);
        }
    }
}
module.exports = static;